Uploaded image for project: 'ZooKeeper'
  1. ZooKeeper
  2. ZOOKEEPER-374

Uninitialized struct variable in C causes warning which is treated as an error

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Trivial
    • Resolution: Fixed
    • 3.1.1
    • 3.2.0
    • c client
    • None
    • i686-apple-darwin9-gcc-4.0.1 (GCC) 4.0.1 (Apple Inc. build 5490)

    • Reviewed

    Description

      nitay-joffes-macbook-pro:c nitay$ pwd
      /Users/nitay/code/zookeeper/src/c

      nitay-joffes-macbook-pro:c nitay$ make
      make all-am
      /bin/sh ./libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I./include -I./tests -I./generated -Wall -Werror -g -O2 -MT zookeeper.lo -MD -MP -MF .deps/zookeeper.Tpo -c -o zookeeper.lo `test -f 'src/zookeeper.c' || echo './'`src/zookeeper.c
      libtool: compile: gcc -DHAVE_CONFIG_H -I. -I./include -I./tests -I./generated -Wall -Werror -g -O2 -MT zookeeper.lo -MD -MP -MF .deps/zookeeper.Tpo -c src/zookeeper.c -fno-common -DPIC -o .libs/zookeeper.o
      cc1: warnings being treated as errors
      src/zookeeper.c: In function 'zoo_add_auth':
      src/zookeeper.c:2378: warning: 'auth.buff' may be used uninitialized in this function
      src/zookeeper.c:2378: warning: 'auth.len' may be used uninitialized in this function
      make[1]: *** [zookeeper.lo] Error 1
      make: *** [all] Error 2

      Need to set auth.buff and auth.len to zero.

      Attachments

        1. ZOOKEEPER-374.patch
          3 kB
          Patrick D. Hunt

        Activity

          People

            phunt Patrick D. Hunt
            nitay Nitay Joffe
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: